MAX_SPD = 95
MIN_SPD = 90

music_table1 = \
(
    (str({'SPEED':50}), ),
    ("0=1",),
    # 1
    ("0=3/8", "1+:3:7=1/8"),
    ("6=3/4",),
    ("0=1/4", "0=1/8", "1+:3:7=1/8"),
    ("6=3/4",),

    # 5
    ("0=3/8", "6:1+:5+=1/8"),
    ("4+=3/8", "0=1/4", "6=1/8"),
    ("5,2=1/4", "0=1/8", "5+,5=1/4", "3+=1/8"),
    ("6+,6=1/2", "0:1+=1/8"),

    #9
    ("6=3/8", str({'SPEED':100}), "1++,1+:3+,3:7+,7=1/8"),
    ("6+,6=3/8", str({'SPEED':100}), "0=1/4", "7-=1/8"),
    ("6-=1/8", "0=1/4", "1++,1+:3+,3:7+,7=1/8"),
    ("6+,6=3/8", "0=1/4", "7-=1/8"),

    # 13
    (str({'SPEED':MAX_SPD}),),
    ("6-=1/8", "0=1/4", "6+,6:1++,1+:5++,5+=1/8"),
    ("4++,4+=3/8", "4++,4+:3++,3+:4++,4+=1/8"),
    ("5++,2++,5+=1/4", "0=1/8", "5++,5+:3++,3+:5++,5+=1/8"),
    ("6++,6+=1/2", "0:3=1/8"),

    #17
    ("6=3/8", "0:1+:7=1/8"),
    ("6=1/4", "5=1/8", "6=1/4", "5=1/8"),
    ("6:6:5=1/8", "6=1/4", "1+=1/8"),
    ("2+:2+:1+=1/8", "2+=1/4", "1+=1/8"),

    #21
    ("6=3/8", "0:1+:2+=1/8"),
    ("3+:3+:3+:3+:2+:1+=1/8",),
    ("3+:3+:3+:3+:2+:1+=1/8",),
    ("3+=3/4",),

    #25
    ("0=1/2", "1+:7,7-=1/8"),
    ("6=1/4", "5=1/8", "6=1/4", "5=1/8"),
    ("6:6:5=1/8", "6=1/4", "1+=1/8"),
    ("2+:2+:2+:2+:6=1/8","3+=1/4"),

    #29
    ("2+=3/8", "1+:2+=1/8"),
    ("3+:3+:3+:3+:2+:1+=1/8",),
    ("3+:3+:3+:3+:2+:1+=1/8",),
    ("3+=3/4",),

    #33
    (str({'SPEED':MAX_SPD}), "5+,3+,7=1/4", "0=1/8", "3+,7:5+,3+,7:3+,7=1/8"),
    ("6+,4+,1+=1/4", "5+,2+,7:6+,4+,1+:5+,3+,7:2+,7=1/8"),
    ("3+,1+,5=3/8", "3+,7:5+,3+,7:3+,7=1/8"),
    ("6+,4+,1+=1/4", "5+,2+,7:6+,4+,1+:5+,3+,7:2+,7=1/8"),

    #37
    ("3+,1+,5=3/8", "6:1+,6:6=1/8"),
    ("3+=1/4", "2+:2+:1+:6=1/8"),
    ("5+,3+,7=1/4", "5+:5+:3+:2+=1/8"),
    ("3+,1+=1/4", "3+:3+:2+:1+=1/8"),

    #41
    ("1+,6=1/4", "0:3+,7:5+,3+,7:3+,7=1/8"),
    ("6+,3+,1+=1/4", "5+,2+,7:6+,4+,1+:5+,3+,7:2+,7=1/8"),
    ("3+,1+,5=3/8", "3+,7:5+,3+,7:3+,7=1/8"),
    ("1++,6+,4+=1/4", "1++,6+,4+:1++,6+,4+:6+,2+:5+,1+=1/8"),

    #45
    ("3+,1+,5=3/8", "6:1+,6:6=1/8"),
    ("3+,7,5=1/4", "2+,6,4:2+,6,4:1+,5,3:6,3,1=1/8"),
    ("5+,3+,7=1/4", "5+,3+,7:5+,3+,7:3+,7,5=1/8", "5+,2+,7=1/4"),
    ("6+,3+,1+=1/4", "0=1/4", "1,6-,4-=1/8"),

    #49
    ("1,6,4=3/8", "1++,1+:7+,7:5+,5=1/8"),
    ("6+,4+,1+,6=1/4", "5+:6+,4+:5+:2+=1/8"),
    ("3+:1+=3/8", "3+:5+:3+=1/8"),
    ("6+,4+,1+=1/4", "5+,2+,7:6+,4+,1+:5+,3+,7:2+,7=1/8"),

    #53
    ("3+,1+,5=3/8", "6:1+,6:6=1/8"),
    ("3+=1/4", "2+:2+:1+:6=1/8"),
    ("5+,3+,7=1/4", "5+:5+:3+:2+=1/8"),
    ("3+,1+=1/4", "3+:3+:2+:1+=1/8"),

    #57
    ("1+,6=1/4", "0:3+,7:5+,3+,7:3+,7=1/8"),
    ("6+,3+,1+=1/4", "5+,2+,7:6+,4+,1+:5+,3+,7:2+,7=1/8"),
    ("3+,1+,5=3/8", "3+,7:5+,3+,7:3+,7=1/8"),
    ("1++,6+,4+=1/4", "1++,6+,4+:1++,6+,4+:6+,2+:5+,1+=1/8"),

    #61
    ("3+,1+,5=3/8", "6:1+,6:6=1/8"),
    ("3+,7,5=1/4", "2+,6,4:2+,6,4:1+,5,3:6,3,1=1/8"),
    ("5+,3+,7=1/4", "5+,3+,7:5+,3+,7:3+,7,5=1/8", "5+,2+,7=1/4"),
    ("6+,3+,1+=1/4", "0=1/4", "1,6-,4-=1/8"),

    #65
    ("6=3/8","1++:3+:7+=1/8"),
    ("6+=3/4",),
    ("0=3/8", "1+:3:7=1/8"),
    ("6=3/4",),

    #69
    ("0=3/8", "6:1+:5+=1/8"),
    ("4+=3/8", "0=1/4", "6=1/8"),
    ("{'BEAT':87}",),
    ("5,2=1/4", "0=1/8", "5+,5=1/4", "3+=1/8"),
    ("6+,6=1/2", "0:4=1/8"),

    # 73
    ("1+=3/8", "0=3/8"),
    ("3:1=1/32", "7-=3/8", "0=5/16"),
)

MAX_SPD_L = 90
MIN_SPD_L = 70

music_table2 = \
(
    (str({'SPEED':60}), ),
    ("0=1",),

    # 1
    ("0=3/4",),
    ("6--:3-:7-:3,1:3-=1/8", "7-=1/2"),
    ("0=1/4", "5--=1/8"),
    ("4--:1-:5-=1/8", "3,1=3/8"),

    #5
    ("6-=3/8", "0=1/4", "3--=1/8"),
    ("2--:6--:4-=1/8", "4,1=1/8", "0=1/4"),
    ("3--:7--:5-=1/8", "0=3/8"),
    ("4--:1-:5-:6-:1:0=1/8",),

    #9
    ("0=3/8", str({'SPEED':100}), "3-,7--=1/4", str({'SPEED':0}),"3-,7--,3--=1/8"),
    (str({'SPEED':100}), "6--,6---=1/8",str({'SPEED':100}), "3-:7-:3,1:3-=1/8", str({'SPEED':0}), "6--,6---=1/8", ),
    ("6--,6---=1/8", str({'SPEED':MIN_SPD_L}), "3-:7-:3,1:3-=1/8", str({'SPEED':MIN_SPD_L}),"5--,5---=1/8",),
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8",str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),

    #13
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "3--,3---=1/8",),
    ("2--,2---=1/8", str({'SPEED':MIN_SPD_L}), "6--:4-:4,1:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),
    ("3--,3---=1/8", str({'SPEED':MIN_SPD_L}), "7--:5-:2,7-:5-=1/8", str({'SPEED':MAX_SPD_L}),"5--,5---=1/8",),
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:5-:6-:1=1/8", str({'SPEED':MAX_SPD_L}),"4--,4---=1/8",),

    #17
    (str({'SPEED':MIN_SPD_L}),"4--,4---=1/2", "0=1/4"),
    ("6--:3-:6-:1:6-:3-=1/8",),
    ("6--:3-:6-:1:6-:3-=1/8",),
    ("2--:2-:4-:6-:4-:2-=1/8",),

    #21
    ("2--:2-:4-:6-:4-:2-=1/8",),
    ("1--:3-:5-:1:5-:3-=1/8",),
    ("5--:3-:5-:1:5-:3-=1/8",),
    ("3--:7--:3-:5-:3-:7--,3--=1/8",),

    #25
    ("3--:0:2-:3-:5-:3--=1/8",),
    ("6---:3-:6-:1:6-:3-=1/8",),
    ("6---:3-:6-:1:6-:3-=1/8",),
    ("2--:2-:4-:6-:4-:2-=1/8",),

    #29
    ("2--:2-:4-:6-:4-:2-=1/8",),
    ("1--:3-:5-:1:5-:3-=1/8",),
    ("5--:3-:5-:1:5-:3-=1/8",),
    ("3--:7--:3-:5-:3-:7--,3--=1/8",),

    #33
    ("3--,3---=1/4", "0=1/8", str({'SPEED':MAX_SPD_L}), "3-,7--=1/4", str({'SPEED':MIN_SPD_L}), "3-,7--,3--=1/8"),
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--=1/8",),
    ("1-,1--=1/8", str({'SPEED':MIN_SPD_L}), "1-:3-:7-,5-:3-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),

    #37
    ("1-,1--=1/8", str({'SPEED':MIN_SPD_L}), "1-:3-:7-,5-:3-=1/8", str({'SPEED':MAX_SPD_L}), "3--,3---=1/8",),
    ("2--,2---=1/8", str({'SPEED':MIN_SPD_L}), "6--:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),
    ("3--,3---=1/8", str({'SPEED':MIN_SPD_L}), "7--:5-:2,7-:5-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),
    ("6--,6---=1/8", str({'SPEED':MIN_SPD_L}), "3-:7-:3,1:3-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),

    #41
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "3-=1/8",),
    ("6--,6---=1/8", str({'SPEED':MIN_SPD_L}), "3-:7-:3,1:3-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),
    ("1-,1--=1/8", str({'SPEED':MIN_SPD_L}), "1-:3-:7-,5-:3-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),

    #45
    ("1-,1--=1/8", str({'SPEED':MIN_SPD_L}), "1-:3-:7-,5-:3-=1/8", str({'SPEED':MAX_SPD_L}), "3--,3---=1/8",),
    ("2--,2---=1/8", str({'SPEED':MIN_SPD_L}), "6--:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),
    ("3--,3---=1/8", str({'SPEED':MIN_SPD_L}), "7--:5-:2,7-:5-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),

    #49
    ("4--,4---", str({'SPEED':MIN_SPD_L}), "0=5/8"),
    ("4-,1-,6--:4-,1-,6--:0=1/8", "0=3/8"),
    ("5-,3-,1-=1/8", "0:5-,2-,7--=1/4", "5--,5---=1/8"),
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),

    #53
    ("1-,1--=1/8", str({'SPEED':MIN_SPD_L}), "1-:3-:7-,5-:3-=1/8", str({'SPEED':MAX_SPD_L}), "3--,3---=1/8",),
    ("2--,2---=1/8", str({'SPEED':MIN_SPD_L}), "6--:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),
    ("3--,3---=1/8", str({'SPEED':MIN_SPD_L}), "7--:5-:2,7-:5-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),
    ("6--,6---=1/8", str({'SPEED':MIN_SPD_L}), "3-:7-:3,1:3-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),

    #57
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "3-=1/8",),
    ("6--,6---=1/8", str({'SPEED':MIN_SPD_L}), "3-:7-:3,1:3-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),
    ("1-,1--=1/8", str({'SPEED':MIN_SPD_L}), "1-:3-:7-,5-:3-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),

    #61
    ("1-,1--=1/8", str({'SPEED':MIN_SPD_L}), "1-:3-:7-,5-:3-=1/8", str({'SPEED':MAX_SPD_L}), "3--,3---=1/8",),
    ("2--,2---=1/8", str({'SPEED':MIN_SPD_L}), "6--:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),
    ("3--,3---=1/8", str({'SPEED':MIN_SPD_L}), "7--:5-:2,7-:5-=1/8", str({'SPEED':MAX_SPD_L}), "5--,5---=1/8",),
    ("4--,4---=1/8", str({'SPEED':MIN_SPD_L}), "1-:4-:1,6-:4-=1/8", str({'SPEED':MAX_SPD_L}), "4--,4---=1/8",),

    #65
    ("4--,4---=1/2", "0=1/4"),
    ("6--:3-:7-:3,1:3-=1/8", "7-=1/2"),
    ("0=1/4", "5--=1/8"),
    ("4--:1-:5-=1/8", "3,1=3/8"),

    #69
    ("6-=3/8", "0=1/4", "3--=1/8"),
    ("2--:6--:4-:4,1=1/8", "0=1/4"),
    ("{'BEAT':87}",),
    ("3--:7--:5-=1/8", "0=3/8"),
    ("4--:1-:5-:6-:1:0=1/8"),

    #73
    ("0=3/4",),
    ("6---=1/2", "0=1/4"),


)


import sys
sys.path.append('../../src')
if __name__ == "__main__":
    import piano.music_translate as music_translate
    music_parse = music_translate.music_trans([music_table1, music_table2], beat = 96)
    music_parse.music_to_play_table()
    music_parse.play_music()